/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */


struct ListNode* reverseList(struct ListNode* head){
    if(!head)return head;
    struct ListNode*l1=head,*l2=l1->next,*l0=NULL;
    while(l1)
    {
        l1->next=l0;
        l0=l1;
        l1=l2;
        if(l2!=NULL)
            l2=l2->next;  
    }
    return l0;
}